<template>
    <div>
        <van-nav-bar
            :title="title"
            @click-left="onClickLeft"
            @click-right="onClickRight"
        >
            <template #left v-if="show">
                <van-icon name="arrow-left" size="20" />
                <span style="font-size:16px;color:#1989fa" >返回</span>
            </template>
            <template #right>
                
                <van-popover
                    v-model="showPopover"
                    trigger="click"
                    :actions="actions"
                    @select="onSelect"
                    placement="bottom-end"
                    >
                    <template #reference>
                        <van-icon name="plus" size="20" />  
                    </template>
                </van-popover>
            </template>
            
            
        </van-nav-bar>
        
    </div>
</template>
<script>
import {myFootList} from "@/utils"
import { Toast } from 'vant';
export default {
    setup() {
        
    },
    methods:{
        onClickLeft(){
            // console.log(this.$router.history);
            this.$router.go(-1);
            // document.history.go(-1);
            // console.dir(this.$router.back())
            // console.dir(this.$router.go(-1))
            // history.go(-1)
        },
        onClickRight(){
            this.showPopover = true
        },
        onSelect(actions){
            if(this.$route.name!=actions.name){
                this.$router.push({name:actions.name})
            }
        },
        onLogin(){

        }
    },
    props:{
        // title:myFootList.text
        title:String,
        show:{
            type:Boolean,
            default:false,
        }
    },
    data(){
        return{
            myFootList:myFootList,
            showPopover: false,
            actions: [{ text: '登录',name:'login' }, { text: '注册',name:'register' }, { text: '扫一扫' }],

        }
    }
}
</script>
<style scoped>
    
</style>